import React from 'react'
import ReactDOM from 'react-dom'
import { Router, Route, IndexRoute, browserHistory } from 'react-router'


import App from './components/App';

const Domain = (location, cb) => {
  require.ensure([], require => {
    cb(null, require('./components/project/Domain/Domain').default);
  }, 'Domain');
};
const DomainAdd = (location, cb) => {
  require.ensure([], require => {
    cb(null, require('./components/project/Domain/Add').default);
  }, 'DomainAdd');
};

const Server = (location, cb) => {
  require.ensure([], require => {
    cb(null, require('./components/project/Server').default);
  }, 'Server');
};

ReactDOM.render(
      <Router history={browserHistory}>
        <Route path="/" component={App}> {/*主页*/}
          <IndexRoute getComponent={Domain}/> {/*默认*/}
          <Route path="Domain" getComponent={Domain}/>
          <Route path="/Domain/:userName/:repoName" component={Domain}/>
          <Route path="Server" getComponent={Server}/>
        </Route>
      </Router>, document.getElementById('App')
);

import './static/css/style.less'